﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    public class DebugAndRelease
    {  /// <summary>
       /// 以下代码，debug和release不一样
       /// c#中写是易失性写，读是非易失性读，在本文中可以理解为，c#会对对象读取做一定的优化。
       /// </summary>
        public void Show()
        {
            int i = 1;

            Task.Run(() => { i = int.MinValue; });

            do { }
            while (i > 0);
        }

        public void Show2()
        {
            for (int i = 0; i < 1000; i++)
            {
                Thread.Sleep(1000);
                Debug.WriteLine("这是调试信息");
                Debugger.Log(0, null, "这是Debugger.Log输出的调试信息");
            }
        }
    }
}
